"""
商品和评价相关Schema
"""
from pydantic import BaseModel
from typing import Optional
from datetime import datetime
from decimal import Decimal


class GoodsResponse(BaseModel):
    """商品响应模型"""
    id: int
    name: str
    description: Optional[str] = None
    price: Optional[Decimal] = None
    image_url: Optional[str] = None
    category: Optional[str] = None
    stock: Optional[int] = 0
    status: int
    created_at: datetime
    
    class Config:
        from_attributes = True


class GoodsReviewRequest(BaseModel):
    """商品评价请求模型"""
    goods_id: int
    content: str


class GoodsReviewResponse(BaseModel):
    """商品评价响应模型"""
    id: int
    user_id: int
    goods_id: int
    content: str
    score: Decimal
    created_at: datetime
    
    class Config:
        from_attributes = True


class RecommendationResponse(BaseModel):
    """推荐响应模型"""
    goods_id: int
    name: str
    description: Optional[str] = None
    price: Optional[Decimal] = None
    image_url: Optional[str] = None
    category: Optional[str] = None
    score: Optional[float] = None  # 推荐分数

